//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

using System;
using System.Collections.ObjectModel;
using Microsoft.Research.ScientificWorkflow.ManagementStudioModels;
using SR = Microsoft.Research.DataLayer;
using System.Collections.Generic;

namespace ManagementStudioServices.Interfaces
{
    /// <summary>
    /// This interface abstracts the implementation of the helper methods.
    /// </summary>
    public interface IWorkflowManagerService
    {
        SR.Connection CurrentConnection { get; }

        Collection<SR.Activity> GetAvailableWorkflows(SR.Activity.ISearch.ISearchClause filter);

        Collection<SR.Job> GetRunningWorkflows(SR.Job.ISearch.ISearchClause filter);

        Collection<SR.Activity> GetDeletedWorkflows(SR.Activity.ISearch.ISearchClause filter);

        Collection<SR.Job> GetCompletedJobs(SR.Job.ISearch.ISearchClause filter);

        Collection<SR.Job> GetWorkflowJobInstances(Guid workflowId);

        void DeleteWorkflow(Guid workflowId);

        void OpenComposerForEdit(Guid workflowId);

        void OpenMonitor(Guid jobId);

        void TerminateJob(Guid jobId);

        void DeleteJob(Guid jobId);

        Collection<SR.Machine> GetAllMachines(bool? isInteractive);

        Collection<SR.Machine> GetAllMachinesWithName(string name);

        Collection<SR.User> GetAllUsers(SR.User.ISearch.ISearchClause filter);

        Collection<SR.User> GetAllAuthenticatedUsers();

        SR.Activity GetWorkflow(Guid workflowId);

        Collection<SR.JobSchedule> GetScheduledJobs(SR.JobSchedule.ISearch.ISearchClause filter);

        SR.JobSchedule GetSchedule(Guid scheduleId);

        void DeleteSchedule(Guid scheduleId);

        SR.JobSchedule CreateSchedule(string jobName, SR.Job job);

        void OpenProvenanceWindow(Guid jobId);

        bool IsWorkflowDeleted(Guid workflowId);

        void CreateActivityInstanceParameter(string paramValue, SR.ActivityInstance activityInstance, SR.ParameterAssignment assignedParameter);

        Collection<SR.ParameterAssignment> GetAllParameterAssignments(SR.ActivitySequence baseActivitySequence);

        void RestoreWorkflow(Guid workflowId);

        void PurgeWorkflow(Guid workflowId);
    }
}
